from afamily import config
import json
from langchain_core.prompts import ChatPromptTemplate
from langchain_community.chat_models import ChatZhipuAI
import os


model = config.configuration['llm']

if model == 'glm-4':
    
    apikey = os.getenv('ZHIPU_APIKEY')
    llm = ChatZhipuAI(
        model="glm-4",
        api_key=apikey,
    )
    from langchain_community.embeddings import ZhipuAIEmbeddings
    embeddings_model = ZhipuAIEmbeddings(model="embedding-2",api_key=apikey)

if model == 'gpt-4o':
    from langchain_openai import OpenAI
    apikey = os.getenv('OPENAI_APIKEY')
    llm = OpenAI(
        model="gpt-4o",
        api_key=apikey,
    )
